package com.kaiwukj.android.ufamily.inteceptor.arouter;

import android.content.Context;

import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.facade.annotation.Interceptor;
import com.alibaba.android.arouter.facade.callback.InterceptorCallback;
import com.alibaba.android.arouter.facade.template.IInterceptor;
import com.blankj.utilcode.util.LogUtils;
import com.kaiwukj.android.ufamily.utils.DoubleClickHelper;

@Interceptor(priority = 7, name = "double click interceptor")
public class DoubleClickInterceptor implements IInterceptor {


    @Override
    public void process(Postcard postcard, InterceptorCallback callback) {
        LogUtils.d("path------------------>" + postcard.getPath());
        if (DoubleClickHelper.isDoubleClick(postcard.getPath())) {
            LogUtils.e("重复点击，已拦截");
            callback.onInterrupt(null);
        } else {
            callback.onContinue(postcard);
        }
    }

    @Override
    public void init(Context context) {

    }


}
